import random
class RandomizedSet(object):

    def __init__(self):
        self.stack = set()
        self.flag = 0
    def insert(self, val):
        """
        :type val: int
        :rtype: bool
        """
        if val in self.stack:
            return False
        else:
            self.stack.add(val)
            self.flag = 1
            return True

    def remove(self, val):
        """
        :type val: int
        :rtype: bool
        """
        if val in self.stack:
            self.stack.remove(val)
            self.flag = 1
            return True
        else:
            return False

    def getRandom(self):
        """
        :rtype: int
        """
        if self.flag:
            self.l = list(self.stack)
        return random.choice(self.l)
